'''
Created on Mar 31, 2010

@author: Jeff
'''

def int2bin(n, count=8):
	"""returns the binary of integer n, using count number of digits
	from http://www.daniweb.com/code/snippet216539.html#"""
	return "".join([str((n >> y) & 1) for y in range(count-1, -1, -1)])

def decodeNum(numStr):
	num = 0
	if len(numStr) > 1 and numStr[0] == '0':
		if len(numStr) > 2 and (numStr[1] == 'x' or numStr[1] == 'X'):	#hex
			numStr = numStr[2:]
			num = int(numStr, 16)
		else:	#octal
			numStr = numStr[1:]
			num = int(numStr, 8)
	else:	#decimal
		num = int(numStr)
	return num

if __name__ == '__main__':
	pass